package lance.honeydew.dao;

import lance.honeydew.bean.ItemInformation;
import lance.honeydew.bean.ItemStock;

import org.apache.log4j.Logger;
import org.hibernate.Session;

public class ItemStockDAO extends RootDAO {
	
	private static final Logger logger = Logger.getLogger(ItemStockDAO.class);
	
	/**
	 * findItemStockBySeqId
	 * @param seqId
	 * @return
	 */
	public ItemStock findItemStockBySeqId(Long seqId) {
		
		ItemStock result = null;
		
		try {
			
			String sqlString = " select s from ItemStock s " +
					" inner join fetch s.Itemseqid i  " +
					" inner join fetch i.Categorybigseqid b  " +
					" inner join fetch i.Categorymedium m  " +
					" where 1=1 " + 
					" and s.Seqid = " + seqId + " ";
			
			
			Session session = getSession();
			result = (ItemStock)session.createQuery(sqlString).list().get(0);
			session.close();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return result;
	}
}